# -*- coding: utf-8 -*-
'''
通过继承基类来得到基类的功能
所以我们把继承的类称作为父类或基类，继承者被称作子类
子类拥有父类的所有属性和方法
父类不具备子类自有的属性和方法
'''

class Parent(object):
    def __init__(self,name,sex):
        self.name = name
        self.sex = sex

    def talk(self):
        print('talk')
        return f'{self.name} are walking'
    def think(self):
        if self.sex == 'boy':
            return f'{self.name} is a boy'
        else:
            return f'{self.name} is a girl'
        print('think')


class ChildOne(Parent):
    def play_football(self):
        return f'{self.name} are playing foodball'

class Child(Parent):
    def swimming(self):
        return f'{self.name} are playing swimming'

c_one = ChildOne(name='lin',sex='boy')
result = c_one.play_football()
talk = c_one.talk()
print(talk)
print(result)